export default function formatTimeDiff(timestamp) {
    const now = new Date().getTime();
    const diff = now - timestamp;

    const oneMinute = 60 * 1000;
    const oneHour = oneMinute * 60;
    const oneDay = oneHour * 24;
    const oneMonth = oneDay * 30;
    const threeMonths = oneMonth * 3;

    if (diff < oneHour) {
        const minutes = Math.floor(diff / oneMinute);
        return `${minutes}分钟`;
    } else if (diff < oneDay) {
        const hours = Math.floor(diff / oneHour);
        return `${hours}小时`;
    } else if (diff < oneMonth) {
        const days = Math.floor(diff / oneDay);
        return `${days}天`;
    } else if (diff < threeMonths) {
        const months = Math.floor(diff / oneMonth);
        return `${months}月`;
    } else {
        return null;
    }
}